(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.test.dashboardDemo.fpdsController', fpdsController);
	fpdsController.$inject = [ '$scope', '$q', 'Constants', 'panelConfig', 'layoutConfig', 'authService', 'validatorConfig', 'ChartJs', 'dashboardDemoService', 'dashboardPanelService' ];
	function fpdsController($scope, $q, Constants, panelConfig, layoutConfig, authService, validatorConfig, ChartJs, dashboardDemoService, dashboardPanelService) {
		var ctrl = this;
		ctrl.panelConfig = panelConfig;
		ctrl.panelConfig.helpMessages = [ ctrl.panelConfig.panelTitle + ' Help!!' ];
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.menus = [ {
			icon : 'remove',
			displayName : 'xxx.xxx.remove',
			action : 'remove'
		}, {
			icon : 'help',
			displayName : 'xxx.xxx.help',
			action : 'help'
		} ];
		ctrl.clickMenu = function(menu) {
			if (menu.action == 'remove') {
				dashboardPanelService.removePanel(ctrl.panelConfig);
			} else if (menu.action == 'help') {
				dashboardPanelService.showPanelHelp(ctrl.panelConfig);
			}
		};
		ctrl.otherConfig = {};
		ctrl.$onInit = function() {
			dashboardDemoService.getPagePanelData(panelConfig.pagePanelId).then(function(response) {
				angular.merge(ctrl.otherConfig, (response && response.panelData) ? response.panelData.otherData : {});
			}, angular.noop);
		};
	}
})(angular);